<template>
  <div>
    <ul>
      <li v-for="item in textList">{{ item.title }}</li>
    </ul>
  </div>
</template>

<script>
  import eventBus from "./eventBus";
  export default {
    name: 'List',
    props: {
      textList: Array
    },
    methods: {
      handleAddItem(title) {
        console.log('title >>>', title);
      }
    },
    mounted () {
      // 监听兄弟组件触发的事件 addItem, 并做出响应,  响应的逻辑写在方法 handleAddItem里面.
      eventBus.$on('addItem', this.handleAddItem);
    }

  }
</script>

<style scoped>

</style>
